package com.chenxiao.httputils.controller;

import com.alibaba.fastjson.JSONObject;
import com.chenxiao.httputils.utils.AjaxResult;
import com.chenxiao.httputils.utils.HttpsRequestTools;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: CX
 * @Date: Created in  2023/12/11 14:15
 * @version: v1.0
 * @Description: TODO
 **/
@RestController
public class LogController {
    @PostMapping("/sendLogs")
    public AjaxResult sendLogs(@RequestBody List<Map<String, Object>> log, @RequestHeader(value = "sysId") String sysId, @RequestHeader(value = "verfyCode") String verfyCode) throws Exception {
        Map<String, Object> headers = new HashMap<>();
        headers.put("sysId",sysId);
        headers.put("verfyCode", verfyCode);
        String result = HttpsRequestTools.sendSSLPosts("http://146.72.16.1:4660/xtas/AcceptLogs", JSONObject.toJSONString(log),headers);
        return new AjaxResult("200", result);
    }
}
